{% extends "base.html" %}
{% block mainbody %}
{#  注意引入文件的方式  #}
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<script src="/static/layui/layui.js"></script>
<script language="JavaScript"> 
function getCookie(c_name)
{
    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=")
      if (c_start!=-1)
        { 
        c_start=c_start + c_name.length+1 
        c_end=document.cookie.indexOf(";",c_start)
        if (c_end==-1) c_end=document.cookie.length
        return unescape(document.cookie.substring(c_start,c_end))
        } 
      }
    return ""
}
retcook=getCookie('AGraph_AJQCDJOWN63628df')
if (retcook=="")
{
    window.location.href="/login";
}else
{
}
</script>

<style>
        #viz {
            width: 1200px;
            height: 450px;
            border: 2px solid lightgray;
            font: 18pt arial;
        }
</style>
<div class="container">
    <div class="row">
    <!--head start-->
    <div class="col-md-12">
        <h3 class="page-header" ><i class="fa fa-share-alt" aria-hidden="true"></i> 进项管理 </h3>
            <ol class="breadcrumb">
                <!--li><i class="fa fa-home"></i><a href="\">Home</a></li-->
                <li><i class="fa fa-share-alt" aria-hidden="true"></i>进项管理</li>
            </ol>
    </div>
    <div>
        <table id="showapply" lay-filter="showapply"></table>
    </div>
    <ol class="breadcrumb">
        <!--li><i class="fa fa-home"></i><a href="\">Home</a></li-->
        <li><i class="fa fa-share-alt" aria-hidden="true"></i>我的关注</li>
    </ol>
    <div>
        <table id="showcollect" lay-filter="showcollect"></table>
    </div>
    <p>
    <div class = "layui-row">
    </div>
    </p>
</div>
</div>
</div>

<script>
    layui.use(['layer', 'table'], function () {
        {#调用按钮#}
        var layer = layui.layer
            , $ = layui.jquery
            , table = layui.table
        //展示已知数据
        tableField = [ //表头
            {field: 'applytype', title: '进项类型', sort: true}
            , {field: 'applyid', title: '进项ID'}
            , {field: 'applydetail', title: '进项详情', event: 'applydetailsouceurl', style:'cursor: pointer;'}
            , {field: 'inputupdate', title: '更新日期', align: 'right'}
        ];

        $.ajax({
                url: '../get_apply_list/',
                type: 'post',
                async:false,
                success: function (data) {
                    console.log(data.data)
                    table.render({
                        elem: '#showapply'
                        , cellMinWidth: 80
                        , data: data.data
                        , page: true //开启分页
                        , cols: [tableField]
                    });
                },
            });
    table.on('tool(showapply)', function(obj){
    var data = obj.data;
    if(obj.event === 'applydetailsouceurl'){
        $.ajax({
                url: `../getapplydetail/?filepath=${data.applydetail}`,
                type: 'post',
                success: function (data) {
                    layer.open({
                        type: 1,
                        title: '事件详情',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['380px', '90%'],
                        content:data.cont
                    }); 
                },
            });

    }
  });
    })
</script>


<script>
    layui.use(['layer', 'table'], function () {
        {#调用按钮#}
        var layer = layui.layer
            , $ = layui.jquery
            , table = layui.table
        //展示已知数据
        tableField = [ //表头
            {field: 'collecttype', title: '类型', sort: true}
            , {field: 'collectcont', title: '内容'}
            , {field: 'inputupdate', title: '更新日期', align: 'right'}
        ];
        
        $.ajax({
                url: '../get_collect_list/',
                type: 'post',
                async:false,
                success: function (data) {
                    console.log(data.data)
                    table.render({
                        elem: '#showcollect'
                        , cellMinWidth: 80
                        , data: data.data
                        , page: true //开启分页
                        , cols: [tableField]
                    });
                },
            });
    })
</script>

{% endblock %}
